writeToFile

suspend fun writeToFile(_: Nothing = nothing, byteBuffer: ByteBuffer, mimeType: MimeType = MimeType.PDF, file: suspend () -> File = { val extension = "." + mimeType.key.split("/").last() File.createTempFile(UUID.randomUUID().toString(), extension) }): File

A helper function that writes byteBuffer into a file.

Return

a file with the content of byteBuffer.

Parameters

byteBuffer

the data that should be written in the temporary file.

mimeType

the mime type of the file. Note that it is used to derive the extension of the newly created file.

file

the file that should be written to.